/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package solicitudesfiec.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Larry
 */
@Entity
@Table(name = "persona", catalog = "dbsofiec", schema = "")
@NamedQueries({@NamedQuery(name = "Persona.findAll", query = "SELECT p FROM Persona p"), @NamedQuery(name = "Persona.findByIdPersona", query = "SELECT p FROM Persona p WHERE p.idPersona = :idPersona"), @NamedQuery(name = "Persona.findByNombres", query = "SELECT p FROM Persona p WHERE p.nombres = :nombres"), @NamedQuery(name = "Persona.findByApellidos", query = "SELECT p FROM Persona p WHERE p.apellidos = :apellidos"), @NamedQuery(name = "Persona.findByCedula", query = "SELECT p FROM Persona p WHERE p.cedula = :cedula"), @NamedQuery(name = "Persona.findByCorreo", query = "SELECT p FROM Persona p WHERE p.correo = :correo"), @NamedQuery(name = "Persona.findByTituloAcademico", query = "SELECT p FROM Persona p WHERE p.tituloAcademico = :tituloAcademico"), @NamedQuery(name = "Persona.findByUsuario", query = "SELECT p FROM Persona p WHERE p.usuario = :usuario")})
public class Persona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue
    @Column(name = "idPersona", nullable = false)
    private Integer idPersona;
    @Column(name = "nombres", length = 100)
    private String nombres;
    @Column(name = "apellidos", length = 100)
    private String apellidos;
    @Column(name = "cedula", length = 10)
    private String cedula;
    @Column(name = "correo", length = 100)
    private String correo;
    @Column(name = "tituloAcademico", length = 50)
    private String tituloAcademico;
    @Column(name = "usuario", length = 250)
    private String usuario;
    @JoinTable(name = "personarol", joinColumns = {@JoinColumn(name = "fkIdPersona", referencedColumnName = "idPersona", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "fkIdRol", referencedColumnName = "idRol", nullable = false)})
    @ManyToMany
    private List<Rol> rolCollection;

    public Persona() {
    }

    public Persona(Integer idPersona) {
        this.idPersona = idPersona;
    }

    public Integer getIdPersona() {
        return idPersona;
    }

    public void setIdPersona(Integer idPersona) {
        this.idPersona = idPersona;
    }

    public String getNombres() {
        return nombres;
    }

    public void setNombres(String nombres) {
        this.nombres = nombres;
    }

    public String getApellidos() {
        return apellidos;
    }

    public void setApellidos(String apellidos) {
        this.apellidos = apellidos;
    }

    public String getCedula() {
        return cedula;
    }

    public void setCedula(String cedula) {
        this.cedula = cedula;
    }

    public String getCorreo() {
        return correo;
    }

    public void setCorreo(String correo) {
        this.correo = correo;
    }

    public String getTituloAcademico() {
        return tituloAcademico;
    }

    public void setTituloAcademico(String tituloAcademico) {
        this.tituloAcademico = tituloAcademico;
    }

    public String getUsuario() {
        return usuario;
    }

    public void setUsuario(String usuario) {
        this.usuario = usuario;
    }

    public List<Rol> getRolCollection() {
        return rolCollection;
    }

    public void setRolCollection(List<Rol> rolCollection) {
        this.rolCollection = rolCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPersona != null ? idPersona.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Persona)) {
            return false;
        }
        Persona other = (Persona) object;
        if ((this.idPersona == null && other.idPersona != null) || (this.idPersona != null && !this.idPersona.equals(other.idPersona))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "solicitudesfiec.entity.Persona[idPersona=" + idPersona + "]";
    }

}
